class Solution(object):
    def checkPerfectNumber(self, num):
        """
        :type num: int
        :rtype: bool
        """
        if num == 1:
            return False
        t = 1
        for k in range(2, int(num ** 0.5) + 1):
            if num % k == 0:
                t += k
                if num // k != k:
                    t += num // k

        return t == num



data = Solution()
num = 28
print(data.checkPerfectNumber(num))
